import 'dart:math';

import 'package:catguard/global/global_data.dart';
import 'package:common_utils/common_utils.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:get/get.dart';

class SelectWifiLogic extends GetxController {
  @override
  void onReady() {
    // TODO: implement onReady
    super.onReady();
  }

  @override
  void onClose() {
    // TODO: implement onClose
    super.onClose();
  }

  connectWifi() {
    EasyLoading.show(status: "正在配网中...");
    Future.delayed(const Duration(milliseconds: 2000), () {
      int min = 0;
      int max = 9;
      int randomInt = Random().nextInt(max - min + 1) + min;
      LogUtil.v("生成的随机数=$randomInt");
      if (randomInt > 4) {
        global.deviceLinkState.value = 2;
      } else {
        global.deviceLinkState.value = 3;
      }
      EasyLoading.dismiss();
    });
  }
}
